package 数组.easy;

import java.util.Arrays;

/**
 * @author Lw中
 * @date 2020/9/15 14:47
 */
public class ErBaSan {

    /**
     * 移动零
     * 使用二分查找方法
     * @param nums
     */
    public static void moveZeroes(int[] nums) {
        int low = 0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] != 0) {
                nums[low] = nums[i];
                low++;
            }
        }
        for (int i = low; i < nums.length; i++) {
            nums[i] = 0;
        }
        System.out.println(Arrays.toString(nums));
    }

    public static void main(String[] args) {
        int[] arr = {0,1};
        moveZeroes(arr);
    }

}
